﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OnTheWay.Models;

namespace OnTheWay.Interfaces
{
    /// <summary>
    /// 带身份认证的接口
    /// </summary>
    /// <typeparam name="string"></typeparam>
    /// <typeparam name="string"></typeparam>
    public interface ICommonBehaviors
    {
        /// <summary>
        /// 插入操作
        /// </summary>
        /// <param name="authid">身份认证ID</param>
        /// <param name="model">对象</param>
        /// <returns>插入成功,则返回true,否则返回false</returns>
        string Insert(string authid, string model);

        /// <summary>
        /// 修改操作
        /// </summary>
        /// <param name="authid">身份认证ID</param>
        /// <param name="model">对象</param>
        /// <returns>修改成功,则返回true,否则返回false</returns>
        string Update(string authid, string model);

        /// <summary>
        /// 删除操作
        /// </summary>
        /// <param name="authid">身份认证ID</param>
        /// <param name="model">对象</param>
        /// <returns>删除成功,则返回true,否则返回false</returns>
        string Delete(string authid, string model);

        /// <summary>
        /// 根据ID获取对象
        /// </summary>
        /// <param name="authid">身份认证ID</param>
        /// <param name="id">实例ID</param>
        /// <returns>符合条件的对象</returns>
        string GetByID(string authid, string id);

        /// <summary>
        /// 更新对象列表
        /// </summary>
        /// <param name="authid">身份认证ID</param>
        /// <param name="list">待更新对象列表</param>
        /// <returns>更新成功,则返回true,否则返回false</returns>
        string UpdateList(string authid, string list);

        /// <summary>
        /// 在数据库中查询是否存在该ID对应的对象
        /// </summary>
        /// <param name="authid">身份认证ID</param>
        /// <param name="id">待查询ID</param>
        /// <returns>存在,则返回true,否则返回false</returns>
        string Exists(string authid, string id);

        /// <param name="list">待删除对象列表</param>
        /// <summary>
        /// 删除对象列表
        /// </summary>
        /// <param name="authid">身份认证ID</param>
        /// <param name="list">待删除对象列表</param>
        /// <returns></returns>
        string DeleteList(string authid, string list);

        /// <summary>
        /// 根据id列表对象
        /// </summary>
        /// <param name="authid">身份认证ID</param>
        /// <param name="id">待删除对象的ID</param>
        /// <returns>删除成功,则返回true,否则返回false</returns>
        string DeleteByID(string authid, string id);

        /// <summary>
        /// 获取满足指定条件的对象数目
        /// </summary>
        /// <param name="authid">身份认证ID</param>
        /// <param name="where">筛选条件</param>
        /// <returns>满足指定条件的对象数目</returns>
        string GetRecordCount(string authid, string where);

        /// <summary>
        /// 以分页形式获取满足指定条件的对象列表
        /// </summary>
        /// <param name="authid">身份认证ID</param>
        /// <param name="page">分页信息</param>
        /// <returns>满足指定条件的对象列表</returns>
        string GetListByPage(string authid, string where, string page);

        /// <summary>
        /// 获取满足指定条件的对象列表
        /// </summary>
        /// <param name="authid">身份认证ID</param>
        /// <param name="where">筛选条件</param>
        /// <param name="order">排序字段</param>
        /// <param name="asc">asc升序排列,desc降序排列</param>
        /// <returns>满足指定条件的对象列表</returns>
        string GetListWhere(string authid, string where, string order, string asc);

        /// <summary>
        /// 获取无效数据
        /// </summary>
        /// <param name="authid">身份认证ID</param>
        /// <returns>满足指定条件的数据列表</returns>
        string GetInValidData(string authid);
        /// <summary>
        /// 以分页形式获取无效数据
        /// </summary>
        /// <param name="authid">身份认证ID</param>
        /// <param name="page">分页信息</param>
        /// <returns>满足指定条件的数据列表</returns>
        string GetInValidDataPage(string authid, string page);
    }
}
